import cv2
import numpy as np

file_path = r'.\resources\red_panda_snow.mp4'
out_path = r'.\src\t2\flipped_red_panda.avi'

cap = cv2.VideoCapture(file_path)
fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter(out_path, fourcc, 25, (640, 360))
while True:
    ret, frame = cap.read()
    frame2 = cv2.flip(frame, 1)
    
    cv2.imshow("frame2", frame2)
    cv2.imshow("frame", frame)
    
    out.write(frame2)
    
    key = cv2.waitKey(25)
    if key == 27:
        break
out.release()
cap.release()
cv2.destroyAllWindows()